package personal.vivian.util;

import java.io.*;

public class SerialzationUtils {
    private static String FILE_NAME="e:/obj.bin";
    public static void writeObject(Serializable s){
        try {
            ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream(FILE_NAME));
            oos.writeObject(s);
            oos.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static Object readObject(){
        Object o=null;
        try {
            ObjectInputStream ois=new ObjectInputStream(new FileInputStream(FILE_NAME));
            o=ois.readObject();
            ois.close();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        return o;
    }
}
